{
  function createButton(text: string,container: HTMLElement,className:string){
    let button: HTMLButtonElement = document.createElement("button")
    button.textContent = text
    if(className){
      button.className = className
    }
    container.appendChild(button)
    return button
  }

  let container : any = document.createElement('div')
  container.classList.add('calculator')
  document.body.appendChild(container)
  let output: HTMLDivElement = document.createElement('div')
  output.classList.add('output')
  let span: HTMLSpanElement = document.createElement('span')
  span.textContent = '0';
  output.appendChild(span)
  container.appendChild(output)

  let n1: number ;
  let n2: number ;
  let oprator: string;
  container.onclick = function(event){
    if(event.target instanceof HTMLButtonElement){
      let button: HTMLButtonElement = event.target;
      let text = button.textContent;
      if('0123456789'.indexOf(text) >= 0){
        console.log("数字")
      }else if('+-*/'.indexOf(text) >= 0){
        console.log("操作符")
      }else{
        console.log("不知道")
      }
    }
  }

  let keys: Array<Array<string>> = [['clear','/'],['7','8','9','*'],['4','5','6','-'],['1','2','3','+'],['0','.','=']];
  keys.forEach((item,index)=>{
    let div: HTMLDivElement = document.createElement('div')    
    div.classList.add('row')
    item.forEach((text:string)=>{
      createButton(text,div,`button text-${text}`)
    })
    container.appendChild(div)
  })
  

  

  

}
